﻿$(function () {
    $("#h_title").text("网站建议");

    $(".cust-btn-reset").click(function () {
        Reset();
    })

    $(".cust-btn-submit").click(function () {
        SubmitSuggest();
    })
})

function Reset() {
    $("#txtPageName,#txtPageLink,#txtaSuggst").val("");
}

function SubmitSuggest() {
    var custEmail = $("#txtEmail").val();
    var custPhone = $("#txtPhone").val();
    var PageLink = $("#txtPageLink").val();
    var Suggst = $("#txtaSuggst").val();
    var PageName = $("#txtPageName").val();

    if (Suggst == null || Suggst == "" || Suggst == undefined) {
        alert("建议不能为空，请填写建议内容");
        return;
    }

    if (Suggst.length > 1000) {
        alert("建议内容不能超过1000个字符");
        return;
    }

    var opartParam = new jsonRow();
    opartParam.AddCell("ACTION", "submitSuggest");
    opartParam.AddCell("email", custEmail);
    opartParam.AddCell("phone", custPhone);
    opartParam.AddCell("pagelink", PageLink);
    opartParam.AddCell("content", Suggst);
    opartParam.AddCell("pagename", PageName);
    $(".cust-btn-submit").attr("disabled", "disabled").text("正在提交");
    ajaxComm(opartParam, null, function () {
        $(".cust-btn-submit").text("提交建议").removeAttr("disabled");
    });
}